package com.wicket.okrframework.web.contorller;

import com.github.pagehelper.Page;
import com.wicket.okrframework.biz.service.AppSceneService;
import com.wicket.okrframework.biz.service.dto.req.*;
import com.wicket.okrframework.biz.service.dto.res.*;
import com.wicket.okrframework.common.ro.OkrResult;
import com.wicket.okrframework.common.util.CommonFunctionHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ：
 * @date ：
 *
 *
 * @version 1.0
 */
@RestController
@RequestMapping("/base/appScene/")
public class AppSceneController {

    @Autowired
    AppSceneService appSceneService;

    /**
   * D1-1查询未赋能业务场景列表
   */
    @PostMapping("queryNotEnabledBizSceneList")
    public OkrResult<QueryNotEnabledBizSceneListRespDto> queryNotEnabledBizSceneList(@RequestBody @Validated QueryNotEnabledBizSceneListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryNotEnabledBizSceneListRespDto retData = appSceneService.queryNotEnabledBizSceneList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D1-1修改业务应用
   */
    @PostMapping("updateBizAppScene")
    public OkrResult<UpdateBizAppSceneRespDto> updateBizAppScene(@RequestBody @Validated UpdateBizAppSceneReqDto reqDTO){
    return OkrResult.success(appSceneService.updateBizAppScene(reqDTO));
    }

    /**
   * D1-1查询业务应用菜单列表（边界）
   */
    @PostMapping("queryBizAppSceneMenuList")
    public OkrResult<QueryBizAppSceneMenuListRespDto> queryBizAppSceneMenuList(@RequestBody @Validated QueryBizAppSceneMenuListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryBizAppSceneMenuListRespDto retData = appSceneService.queryBizAppSceneMenuList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D1-1查询应用赋能场景列表
   */
    @PostMapping("queryBizAppSceneRelList")
    public OkrResult<QueryBizAppSceneRelListRespDto> queryBizAppSceneRelList(@RequestBody @Validated QueryBizAppSceneRelListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryBizAppSceneRelListRespDto retData = appSceneService.queryBizAppSceneRelList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D1-1批量查业务场景
   */
    @PostMapping("batchQueryBizScene")
    public OkrResult<BatchQueryBizSceneRespDto> batchQueryBizScene(@RequestBody @Validated BatchQueryBizSceneReqDto reqDTO){
    return OkrResult.success(appSceneService.batchQueryBizScene(reqDTO));
    }

    /**
   * D1-1新增业务应用
   */
    @PostMapping("addBizAppScene")
    public OkrResult<AddBizAppSceneRespDto> addBizAppScene(@RequestBody @Validated AddBizAppSceneReqDto reqDTO){
    return OkrResult.success(appSceneService.addBizAppScene(reqDTO));
    }

    /**
   * D1-1查询业务应用详情
   */
    @PostMapping("queryBizAppSceneDetail")
    public OkrResult<QueryBizAppSceneDetailRespDto> queryBizAppSceneDetail(@RequestBody @Validated QueryBizAppSceneDetailReqDto reqDTO){
    return OkrResult.success(appSceneService.queryBizAppSceneDetail(reqDTO));
    }

    /**
   * D1-1查询业务应用列表
   */
    @PostMapping("queryBizAppSceneList")
    public OkrResult<QueryBizAppSceneListRespDto> queryBizAppSceneList(@RequestBody @Validated QueryBizAppSceneListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryBizAppSceneListRespDto retData = appSceneService.queryBizAppSceneList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D1-1查询业务场景列表
   */
    @PostMapping("queryBizSceneList")
    public OkrResult<QueryBizSceneListRespDto> queryBizSceneList(@RequestBody @Validated QueryBizSceneListReqDto reqDTO){
    Page<?> page = CommonFunctionHelper.startPage(reqDTO.getPageNum(),reqDTO.getPageSize());

        QueryBizSceneListRespDto retData = appSceneService.queryBizSceneList(reqDTO);

        retData.setPageNum(page.getPageNum());
        retData.setPageSize(page.getPageSize());
        retData.setTotalNum(page.getTotal());
        return OkrResult.success(retData);
    
    }

    /**
   * D1-1查询业务场景详情
   */
    @PostMapping("queryBizSceneDetail")
    public OkrResult<QueryBizSceneDetailRespDto> queryBizSceneDetail(@RequestBody @Validated QueryBizSceneDetailReqDto reqDTO){
    return OkrResult.success(appSceneService.queryBizSceneDetail(reqDTO));
    }

    /**
   * D1-1新增应用赋能场景
   */
    @PostMapping("addBizAppSceneRel")
    public OkrResult<AddBizAppSceneRelRespDto> addBizAppSceneRel(@RequestBody @Validated AddBizAppSceneRelReqDto reqDTO){
    return OkrResult.success(appSceneService.addBizAppSceneRel(reqDTO));
    }

    /**
   * D1-1修改业务场景
   */
    @PostMapping("updateBizScene")
    public OkrResult<UpdateBizSceneRespDto> updateBizScene(@RequestBody @Validated UpdateBizSceneReqDto reqDTO){
    return OkrResult.success(appSceneService.updateBizScene(reqDTO));
    }

    /**
   * D1-1新增业务场景
   */
    @PostMapping("addBizScene")
    public OkrResult<AddBizSceneRespDto> addBizScene(@RequestBody @Validated AddBizSceneReqDto reqDTO){
    return OkrResult.success(appSceneService.addBizScene(reqDTO));
    }
/**
   * D1-1查询业务场景菜单列表
   */
    @PostMapping("queryBizSceneMenuList")
    public OkrResult<QueryBizSceneMenuListRespDto> queryBizSceneMenuList(@RequestBody @Validated QueryBizSceneMenuListReqDto reqDTO){
    return OkrResult.success(appSceneService.queryBizSceneMenuList(reqDTO));
    }
/**
   * D1-1查询赋能的应用列表
   */
    @PostMapping("queryEnablingAppList")
    public OkrResult<QueryEnablingAppListRespDto> queryEnablingAppList(@RequestBody @Validated QueryEnablingAppListReqDto reqDTO){
    return OkrResult.success(appSceneService.queryEnablingAppList(reqDTO));
    }
/**
   * D1-1查询赋能的应用业务场景列表
   */
    @PostMapping("queryEnablingAppSceneList")
    public OkrResult<QueryEnablingAppSceneListRespDto> queryEnablingAppSceneList(@RequestBody @Validated QueryEnablingAppSceneListReqDto reqDTO){
    return OkrResult.success(appSceneService.queryEnablingAppSceneList(reqDTO));
    }
/**
   * D3查询当前被赋能业务场景列表
   */
    @PostMapping("queryCurrentBizAppSceneRelEdList")
    public OkrResult<QueryCurrentBizAppSceneRelEdListRespDto> queryCurrentBizAppSceneRelEdList(@RequestBody @Validated QueryCurrentBizAppSceneRelEdListReqDto reqDTO){
    return OkrResult.success(appSceneService.queryCurrentBizAppSceneRelEdList(reqDTO));
    }
/**
   * D1-1查询赋能的应用业务场景列表(公共)
   */
    @PostMapping("queryEnablingAppSceneListCom")
    public OkrResult<QueryEnablingAppSceneListComRespDto> queryEnablingAppSceneListCom(@RequestBody @Validated QueryEnablingAppSceneListComReqDto reqDTO){
    return OkrResult.success(appSceneService.queryEnablingAppSceneListCom(reqDTO));
    }
}
